package com.yoda.controller.admin;

import com.yoda.dto.EmployeeLoginDto;
import com.yoda.result.Result;
import com.yoda.service.ISysConfigService;
import com.yoda.service.ISysUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController("adminIndexController")
@RequestMapping("/index")
public class IndexController {
    @Autowired
    private ISysUserService sysUserService;
    @Autowired
    private ISysConfigService sysConfigService;

    /**
     * 登入
     * @param dto
     * @return
     */
    @PostMapping("/login")
    public Result login(@RequestBody EmployeeLoginDto dto){
        return sysUserService.login(dto);
    }

    @GetMapping("/getConfig")
    public Result getConfig(){
        return sysConfigService.getConfig();
    }

    @PostMapping("/profile")
    public Result profile(){
        return sysUserService.profile();
    }

    /**
     * 主页统计信息
     * @return
     */
    @GetMapping("/baseInfo")
    public Result baseInfo(){
        return sysUserService.baseInfo();
    }
}
